package zhieasy.cn.xpu_helper.controller.initiation;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import zhieasy.cn.common.utils.ResultVOUtil;
import zhieasy.cn.common.utils.result.ResultUtils;
import zhieasy.cn.common.vo.ResultVO;
import zhieasy.cn.model.common.CollegeInfo;
import zhieasy.cn.model.common.Grade;
import zhieasy.cn.service.initiation.CollegeInfoService;

import java.util.List;

/**
 * @author sofency
 * @date 2020/8/22 10:07
 * @package IntelliJ IDEA
 * @description
 */
@RestController
@RequestMapping("/initiation")
@Api(tags = "开学助手 获取学院的api集合")
public class InitiationController {

    @Autowired
    CollegeInfoService collegeInfoService;

    @RequestMapping(value = "/colleges" , method = RequestMethod.GET)
    @ApiOperation(value = "查询学院的列表",notes = "查询学院的列表")
    public ResultVO<List<CollegeInfo>> getInstituteList(){
        List<CollegeInfo> institutes = collegeInfoService.getColleges();
        return ResultVOUtil.success(institutes);
    }

    @ApiOperation(value = "查询班级的信息",notes = "查询班级的信息")
    @RequestMapping(value = "/grades",method = RequestMethod.GET)
    public ResultVO getGrades(String collegeId,String majorId){
        List<Grade> list = collegeInfoService.getGrades(collegeId,majorId);
        return ResultUtils.success(list);
    }
}
